void CountOff( int n, int m, int out[] )
{
    for(int i=0;i<n;++i){
        out[i] = n;
    }
    int t = 0; 
    int count = 0; 
    int round = 1; 
    while(round<n){
        if(out[t] == n){
            count++;
        }
        if(count == m){ 
            count = 0;
            out[t] =round++;
        }
        t++;
        if(t>n-1){
          t = t % n;
        }
       
    }
}
